package com.why.whyojbackendmodel.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Getter
public enum QuestionSubmitLauguageEnum {
    JAVA("java"),
    PYTHON("python"),
    C("C"),
    CPLUSPLUS("cpp"),

    GOLANG("go");


    private final String value;

    QuestionSubmitLauguageEnum(String value) {
        this.value = value;
    }

    public static List<String> getValues() {
        return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList());
    }

    public static QuestionSubmitLauguageEnum getEnumByValue(String value) {
        for (QuestionSubmitLauguageEnum language : values()) {
            if (language.value.equals(value)) {
                return language;
            }
        }
        return null;

    }
}
